<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div id="visits"></div>

<script th:src="@{/webjars/jquery/3.3.1/jquery.min.js}"></script>
<script type="text/javascript">

    $(document).ready(function(){
        $.ajax({
            url: "/getVisits",
            type: "get",
            success: function (data) {
                alert(data.visits);
                $("#visits").html("当前页面访问量为" + data.visits)
            },
            error: function (e) {
                alert("失败");
            }
        })
    });

</script>
</body>
</html>